From: Sasha Levin Date: Fri, 22 Sep 2023 16:30:21 +0000 (+0200) Subject: netfilter: nf_tables: GC transaction race with abort path X-Git-Tag: archive/raspbian/6.1.55-1+rpi1^2~58 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22Dat/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22Dat?a=commitdiff_plain;h=e62a845729e0fe51211781f3936b6af00050cdff;p=linux.git netfilter: nf_tables: GC transaction race with abort path commit 720344340fb9be2765bbaab7b292ece0a4570eae upstream. Abort path is missing a synchronization point with GC transactions. Add GC sequence number hence any GC transaction losing race will be discarded. Fixes: 5f68718b34a5 ("netfilter: nf_tables: GC transaction API to avoid race with control plane") Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin Gbp-Pq: Topic bugfix/all Gbp-Pq: Name netfilter-nf_tables-gc-transaction-race-with-abort-p.patch --- diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 53ee6ac16f9..0455af9a66a 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -9969,7 +9969,12 @@ static int nf_tables_abort(struct net *net, struct sk_buff *skb, enum nfnl_abort_action action) { struct nftables_pernet *nft_net = nft_pernet(net); - int ret = __nf_tables_abort(net, action); + unsigned int gc_seq; + int ret; + + gc_seq = nft_gc_seq_begin(nft_net); + ret = __nf_tables_abort(net, action); + nft_gc_seq_end(nft_net, gc_seq); mutex_unlock(&nft_net->commit_mutex);